`ifndef SANITY_CASE_SV
`define SANITY_CASE_SV

class sanity_case_seq extends my_sequence;

	extern function new(string name = "sanity_case_seq");
	extern virtual task body();

	`uvm_object_utils(sanity_case_seq)
endclass: sanity_case_seq

function sanity_case_seq::new(string name = "sanity_case_seq");
	super.new(name);
endfunction: new

task sanity_case_seq::body();
	repeat(10) begin
		`uvm_do_with(my_tr, {my_tr.par_err == 0;})
	end
	#100;
endtask: body

class sanity_case extends base_test;

    ral_block_Gjm_sys_global_cfg ral_model;
    uvm_status_e      status;

	extern function new(string name = "base_test", uvm_component parent=null);
	extern virtual function void build_phase(uvm_phase phase);
    extern virtual task main_phase(uvm_phase phase);
	
	`uvm_component_utils(sanity_case)
endclass: sanity_case

function sanity_case::new(string name = "base_test", uvm_component parent=null);
    super.new(name, parent);
endfunction: new

function void sanity_case::build_phase(uvm_phase phase);
	super.build_phase(phase);
	uvm_config_db #(uvm_object_wrapper)::set(
		this,
		"env.i_agt0.sqr.main_phase",
		"default_sequence",
		sanity_case_seq::type_id::get()
	);
    uvm_config_db #(uvm_object_wrapper)::set(
		this,
		"env.i_agt1.sqr.main_phase",
		"default_sequence",
		sanity_case_seq::type_id::get()
	);
    
endfunction: build_phase

task sanity_case::main_phase(uvm_phase phase);
    bit [31:0]data;
    super.main_phase(phase);
    phase.raise_objection(this);
    //this.env.ral_model.global_cfg.status_cfg.set(32'h87654321);
    //$display("ral_model.get = 'h%0h", this.env.ral_model.global_cfg.status_cfg.get());
    this.env.ral_model.global_cfg.status_cfg.write(status, 32'h34343434);
    $display("ral_model.get = 'h%0h", this.env.ral_model.global_cfg.status_cfg.get());
    `uvm_warning("main_phase", "update over!!!!!");
    #10;
    this.env.ral_model.global_cfg.status_cfg.write(status, 32'h33445566);
    $display("ral_model.get = 'h%0h", this.env.ral_model.global_cfg.status_cfg.get());
    `uvm_warning("main_phase", "update over!!!!!");
    
    #10;
    this.env.ral_model.global_cfg.status_cfg.read(status, data);
    $display("ral_model.get = 'h%0h", this.env.ral_model.global_cfg.status_cfg.get());
    `uvm_warning("main_phase", "update over!!!!!");
    phase.drop_objection(this);
endtask: main_phase

`endif
